/* GUI CONVERTED from rsiq03.p (converter v1.76) Wed Aug 21 09:51:39 2002 */
/* rsiq03.p - Release Management - Shipper/Container Inquiry                  */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work      .         */
/* $Revision: 1.8.1.7 $                                                       */
/*V8:ConvertMode=Report                                               */
/* REVISION: 7.3    LAST MODIFIED: 10/16/92           BY: WUG *G462*          */
/* REVISION: 7.3    LAST MODIFIED: 02/18/83           BY: WUG *G695*          */
/* REVISION: 7.3    LAST MODIFIED: 10/18/93           BY: WUG *GG36*          */
/* REVISION: 7.3    LAST MODIFIED: 04/13/94           BY: WUG *H614*          */
/* REVISION: 7.3    LAST MODIFIED: 11/17/94           BY: jxz *GO50*          */
/* REVISION: 8.6    LAST MODIFIED: 03/17/97   BY: *K080* Kieu Nguyen          */
/* REVISION: 8.6    LAST MODIFIED: 04/02/97   BY: *K09H* Vinay Nayak-Sujir    */
/* REVISION: 8.6    LAST MODIFIED: 10/21/97   BY: ays *K13M*                  */
/* REVISION: 8.6E   LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane            */
/* REVISION: 8.6E   LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan           */
/* REVISION: 9.1    LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane     */
/* REVISION: 9.1    LAST MODIFIED: 08/12/00   BY: *N0KP* Mark Brown           */
/* Old ECO marker removed, but no ECO header exists *F0PN*                    */
/* Revision: 1.8.1.4     BY: Jean Miller       DATE: 05/21/02  ECO: *P05V*  */
/* $Revision: 1.8.1.7 $    BY: Ellen Borden      DATE: 08/20/02  ECO: *P0FY*  */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

/* SHIPPER/CONTAINER INQUIRY */

/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

{mfdtitle.i "2+ "}

define shared variable global_recid as recid.

define variable type like mfc_logical label "Type" format "Shipper/Container"
    initial yes.
define variable ctype as character label "T" format "x(1)".
define variable disp_abs_id as character.

define variable indent_id as character format "x(20)" label "ID".



/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   
 RECT-FRAME       AT ROW 1 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1 COLUMN 3 NO-LABEL VIEW-AS TEXT SIZE-PIXELS 1 BY 1
 SKIP(.1)  /*GUI*/
type                 colon 28
   abs_shipfrom         colon 28 label "Supplier"
   ad_name              at 45 no-label
   abs_id               colon 28 label "Shipper/Container ID"
   ad_line1             at 45 no-label
with frame a side-labels width 80 attr-space NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER INITIAL "".
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:HIDDEN in frame a = yes.
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5.  /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

FORM /*GUI*/ 
   abs_shipto           colon 20 label "Ship-To/Dock"
   si_desc
with STREAM-IO /*GUI*/  frame b side-labels width 80 attr-space.

/* SET EXTERNAL LABELS */
setFrameLabels(frame b:handle).

find abs_mstr where recid(abs_mstr) = global_recid no-lock no-error.

if available abs_mstr and (abs_id begins "s" or abs_id begins "c")
   and abs_type = "r"
then do:

   type = abs_id begins "s".

   find ad_mstr where ad_addr = abs_shipfrom no-lock.

   display
      abs_shipfrom
      abs_id format "x(1)" @ type
      substring(abs_id,2,50) @ abs_id
      ad_name
      ad_line1
   with frame a.

end.

display type with frame a.

{wbrp01.i}
repeat:

   do with frame a:

      if c-application-mode <> 'web' then
         prompt-for type abs_shipfrom abs_id
      editing:

         assign
            global_addr = input abs_shipfrom
            global_loc = string(input type).

         if frame-field = "abs_shipfrom" then do:

            {mfnp05.i abs_mstr abs_id
               "abs_id begins input type"
               abs_shipfrom
               "input abs_shipfrom"}

            if recno <> ? then do:

               find ad_mstr where ad_addr = abs_shipfrom no-lock.

               assign
                  disp_abs_id = substring(abs_id,2,50).

               display
                  abs_shipfrom
                  disp_abs_id @ abs_id
                  ad_name
                  ad_line1.
            end.

         end.

         else
         if frame-field = "abs_id" then do:

            {mfnp05.i abs_mstr abs_id
               "abs_shipfrom = input abs_shipfrom
                 and abs_id begins input type"
               abs_id
               "ctype  + input abs_id"}

            if recno <> ? then do:
               find ad_mstr where ad_addr = abs_shipfrom no-lock.

               assign
                  disp_abs_id = substring(abs_id,2,50).

               display
                  abs_shipfrom
                  disp_abs_id @ abs_id
                  ad_name
                  ad_line1.
            end.

         end.

         else do:
            status input.
            readkey.
            apply lastkey.
         end.

      end.

      {wbrp06.i &command = prompt-for &fields = "  type abs_shipfrom abs_id"
         &frm = "a"}

   end.

   if (c-application-mode <> 'web') or
      (c-application-mode = 'web' and
      (c-web-request begins 'data'))
   then do:

      assign type.
      assign ctype = if type then "s" else "c".

      find abs_mstr where abs_shipfrom = input abs_shipfrom
                      and abs_id = ctype + input abs_id
                      and abs_type = "r"
      no-lock no-error.

      if not available abs_mstr then do:
         /* Shipper or Container ID does not exist */
         {pxmsg.i &MSGNUM=8176 &ERRORLEVEL=3}
         bell.
         if c-application-mode = 'web' then return.
         undo, retry.
      end.

      find vd_mstr where vd_addr = abs_shipfrom no-lock no-error.
      if not available vd_mstr then do:
         {pxmsg.i &MSGNUM=2 &ERRORLEVEL=3}
         bell.
         if c-application-mode = 'web' then return.
         undo, retry.
      end.

      find ad_mstr where ad_addr = abs_shipfrom no-lock.

      hide frame b no-pause.

   end.

   /* OUTPUT DESTINATION SELECTION */
   {gpselout.i &printType = "terminal"
               &printWidth = 80
               &pagedFlag = " "
               &stream = " "
               &appendToFile = " "
               &streamedOutputToTerminal = " "
               &withBatchOption = "no"
               &displayStatementType = 1
               &withCancelMessage = "yes"
               &pageBottomMargin = 6
               &withEmail = "yes"
               &withWinprint = "yes"
               &defineVariables = "yes"}
/*GUI*/ RECT-FRAME:HEIGHT-PIXELS in frame a = FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.


   assign
      disp_abs_id = substring(abs_id,2,50).

   find si_mstr where si_site = abs_shipto no-lock.

   display
      abs_shipto
      si_desc
   with frame b STREAM-IO /*GUI*/ .

   put skip(1).

   {gprun.i ""rsiq03b.p"" "(input recid(abs_mstr), input 0)"}

   {mfreset.i}
/*GUI*/ {mfgrptrm.i} /*Report-to-Window*/

   {pxmsg.i &MSGNUM=8 &ERRORLEVEL=1}

   if abs_par_id > "" then do:
      /* This is subordinate to # */
      {pxmsg.i &MSGNUM=8102 &ERRORLEVEL=1 &MSGARG1=abs_par_id}
   end.

   assign
      global_recid = recid(abs_mstr).
end.

{wbrp04.i &frame-spec = a}
